<?php

namespace Sifast\ProjectBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;

class AdresseAdmin extends Admin
{

    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
       
            ->with('L1')
                
            ->add('numVoie','text',array(
                'label'=> 'Numéro de la voie:',))
                
            ->add('pays', 'choice', array(
                'label'=> 'Pays:',
                'choices' => array(
                        'Choisir le pays' => 'Choisir le pays',
                        'Tunisie' => 'Tunisie',
                        'France' => 'France',
                        'Autre' => 'Autre')
                )) 
            ->end()
            ->with('L2')  
            ->add('nomVoie','text',array(
                'label'=> 'Nom de la voie:',))
            ->add('ville', 'choice', array(
                    'label'=> 'Ville:',
                    'choices' => array(
                        'Choisir le pays' => 'Choisir la ville',
                        'Sfax' => 'Sfax',
                        'Sousse' => 'Sousse',
                        'Tunis' => 'Tunis',
                        'Autre' => 'Autre')
                ))  
            ->end()
            ->with('L3')     
            ->add('localite','text',array(
                'label'=> 'Localité:',))
           
            ->add('dateDebut', 'date', array(
                    'label'=> 'Date de debut:',
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy',
                    'attr' => array('class' => 'datepicker')
                ))
            ->end()  
            ->with('L4')    
            ->add('codePostal','text',array(
                'label'=> 'Code postal:',)) 
            
            
            
            ->add('dateFin', 'date', array(
                    'label'=> 'Date de fin:',
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy',
                    'attr' => array('class' => 'datepicker')
                ))
            ->end();
            
    }

    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
           
           ->add('numVoie')
            ->add('nomVoie')
            ->add('localite')
            ->add('codePostal') 
            ->add('pays')
            ->add('ville')
            ->add('dateDebut')
            ->add('dateFin');
            
    }

    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
                     
            ->addIdentifier('numVoie')
            ->add('nomVoie')
            ->add('localite')
            ->add('codePostal') 
            ->add('pays')
            ->add('ville')
            ->add('dateDebut')
            ->add('dateFin');
            
            }
           
}
